package com.njym.java.security.admin.rest;


import com.njym.java.security.admin.biz.CourseClassifyBiz;
import com.njym.java.security.admin.entity.CourseClassify;
import com.njym.java.security.common.rest.BaseController;
import com.njym.java.security.common.util.ResponseUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import tk.mybatis.mapper.entity.Example;

@Controller
@RequestMapping("courseClassify")
public class CourseClassifyController extends BaseController<CourseClassifyBiz, CourseClassify> {

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public Object list(String name){
        Example example = new Example(CourseClassify.class);
        if (StringUtils.isNotBlank(name)) {
            example.createCriteria().andLike("name", "%" + name + "%");
        }
        return ResponseUtil.ok(baseBiz.selectByExample(example));
    }
}